<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%String path = request.getContextPath() ;%>
<%@ taglib uri="/WEB-INF/tld/c.tld" prefix="c" %> 
<!DOCTYPE html>
<html lang="zh-CN" >
<head>
<c:set var="ctx" value="${pageContext.request.contextPath}" />
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>厂商详情</title>
<jsp:include page="../../import.jsp" flush="true" />
</head>
<body class="iframeBody">
<div class="Wrapper">
<div class="Wrapper">
	<div id="pageInTab" class="pageInTab">
		<div tabid="tabA" title="基本信息" lselected="true">
            <form id="formSet1">
            	<div class="fieldset1 tabel_col clearFix">
            		<div class="caption">
                        <span class="title">厂商信息</span>
                    </div>
                    <div class="fieldBox col_33">
	                    <div class="label">厂商名称</div>
	                    <div class="field">
	                    	<span name="mfrName" id="mfrName">&nbsp;</span>
	                    	<input name="mId" id="mId" type="hidden" value="${id }">
	                    </div>
	                </div>
	                <div class="fieldBox col_33">
	                    <div class="label">统一社会信用代码</div>
	                    <div class="field">
	                    	<span name="succ" id="succ">&nbsp;</span>
	                    </div>
	                </div>
                    <!-- <div class="fieldBox col_33">
	                    <div class="label">是否供应商</div>
	                    <div class="field">
	                    	<span name="isSpl" id="isSpl">&nbsp;</span>
	                    </div>
	                </div> -->
                    <div class="fieldBox col_66">
	                    <div class="label">厂商地址</div>
	                    <div class="field">
	                    	<span name="mfrAddr" id="mfrAddr">&nbsp;</span>
	                    </div>
	                </div>
                    <div class="fieldBox col_66">
	                    <div class="label">区域</div>
	                    <div class="field">
	                    	<span name="rgnNms" id="rgnNms">&nbsp;</span>
	                    </div>
	                </div>
                    <div class="fieldBox col_33">
	                    <div class="label">办公电话</div>
	                    <div class="field">
	                    	<span name="mfrTel" id="mfrTel">&nbsp;</span>
	                    </div>
	                </div>
					<div class="fieldBox col_100">
						<div class="label">放款方式</div>
						<div class="field">
							<span name="payTypCdNm" id="payTypCdNm">&nbsp;</span>
						</div>
					</div>
					<div class="fieldBox col_100">
						<div class="label">经销品牌(卡车类)</div>
						<div class="field">
							<span name="tkBrCdNms" id="tkBrCdNms">&nbsp;</span>
						</div>
					</div>
					<div class="fieldBox col_100">
						<div class="label">经销品牌(乘用车类)</div>
						<div class="field">
							<span name="carBrCdNms" id="carBrCdNms">&nbsp;</span>
						</div>
					</div>
					<div class="fieldBox col_100">
						<div class="label">经销品牌(客车类)</div>
						<div class="field">
							<span name="busBrCdNms" id="busBrCdNms">&nbsp;</span>
						</div>
					</div>
            	</div>
            	<div class="sqPanel">
	                <div class="sqPanel_head inL">
	                    <span>社会关系/家庭成员</span>
	                </div>
	                <div class="sqPanel_body">
	                    <div id="ligergrid_A1" class="sq-grid"></div>
	                </div>
	            </div>
                
            </form>
        </div>
		<div tabid="tabB" title="资料信息">
            <iframe frameborder="0" name="tabB" id="tabB" src=""></iframe>
        </div>
        <!-- <div tabid="tabC" title="授信备案">
            <iframe frameborder="0" name="tabC" id="tabC" src=""></iframe>
        </div>
        <div tabid="tabD" title="远程跟踪">
            <iframe frameborder="0" name="tabD" id="tabD" src=""></iframe>
        </div> -->
        <div tabid="tabE" title="备案账号">
            <iframe frameborder="0" name="tabE" id="tabE" src=""></iframe>
        </div>
        <div tabid="tabF" title="相关项目">
            <iframe frameborder="0" name="tabF" id="tabF" src=""></iframe>
        </div>
    </div>
	</div>
</div>
</div>


<script type="text/javascript">

var loadedTabs=[];
var _isMask = '${isMask}'

$(function () {
    $("#formSet1").ligerForm({
        validate : true
    });
   
 	 //初始化数据
    initData();
    
});


function initData(){
	var _id = $("#mId").val();
	var currentOrgCd = '${currentOrgCd}';
	var _url = '<%=path%>/mfr/mfrBscInfo/getById.do';
	$.ajax({
		type: 'get',
		dataType:'json',
		data:{id:_id,currentOrgCd:currentOrgCd,isMask:_isMask},
		url: _url,
		success:function(msg){
			 if(msg.success == 1){
				 setData(msg.data);//设置数据
			 }else{
				 $.ligerDialog.warn(msg.info);
			 }
		}
	});
	initTab();
	initSplRlGrid();
}

//设置页面数据
function setData(data){
	
	var form = new liger.get("formSet1");
	$("#mfrName").html(data.mfrName);
	$("#succ").html(data.succ);
	$("#mfrAddr").html(data.mfrAddr);
	$("#rgnNms").html(data.rgnNms);
	$("#mfrTel").html(data.mfrTel);
    $("#payTypCdNm").html(data.payTypCdNm);
    $("#tkBrCdNms").html(data.tkBrCdNms);
    $("#carBrCdNms").html(data.carBrCdNms);
    $("#busBrCdNms").html(data.busBrCdNms);
	
	if(data.isSpl==1){
		$("#isSpl").html("是");
	}else if(data.isSpl==0){
		$("#isSpl").html("否");
	}
}

//初始化Tab页
function initTab(){
    pageInTab = $("#pageInTab").ligerTab({
        height: 'auto',
        contextmenu: false,
        minIframeHeight: 450,
        onBeforeSelectTabItem: function (tabid) {
            var _mId = $("#mId").val();
            if(tabid!="tabA"){
                if(!_mId){
                    top.$.ligerDialog.SQalert({content: "请确认厂商基本信息已存在", SQ_type: "warning"});
                    return false;
                }
            }
        },
        onAfterSelectTabItem: function(tabid) {
            if (loadedTabs.indexOf(tabid)<0) {
                var _mId = $("#mId").val();
                if(tabid!="tabA"){
                    if(!_mId){
                        top.$.ligerDialog.SQalert({content: "请确认厂商基本信息已存在", SQ_type: "warning"});
                        return false;
                    }
                }
                loadedTabs.push(tabid);
                /*switch (tabid){
                 case "tabB":
                 pageInTab.setTabItemSrc(tabid, "<%=path%>/project/prjQuatPrpsAttr/toAddPage.do?prpsCfgId="+_prpsCfgId);
                 break;
                 case "tabC":
                 pageInTab.setTabItemSrc(tabid, "<%=path%>/project/prjQuatPrpsCfgAi/toListPage.do?prpsCfgId="+_prpsCfgId);
                 break;
                 }*/
                 console.log(tabid);
                switch (tabid){
                    case "tabB":// 资料信息
                    pageInTab.setTabItemSrc(tabid, "<%=path%>/mfr/mfrBscInfo/toMfrFileAddPage.do?mfrId="+_mId+"&isDetail=1");
                    break;
                    case "tabE":// 备案账号
                    pageInTab.setTabItemSrc(tabid, "<%=path%>/mfr/mfrbankacc/toListPageDetail.do?mfrId="+_mId+"&isDetail=1");
                    break;
                    case "tabF":// 相关项目
                    pageInTab.setTabItemSrc(tabid, "<%=path%>/product/mfrInfo/toMfrPrjBscInfoDetailList.do?mfrId="+_mId);
                    break;
                }
            };
            SetIframe_height();
        }
    });
};

//初始化主要人员信息
function initSplRlGrid() {
    var _mId = $("#mId").val();
    var _audStsCd = ${audStsCd}
    if(!_mId){
        return; //验证不通过，不执行以下代码
    }
    $("#ligergrid_A1").ligerGrid({
        usePager: false,
        url: '<%=path%>/mfr/mfrrlpsn/initList.do?mfrId=' +_mId+'&audStsCd='+_audStsCd+'&isMask='+_isMask,
        method : 'get',
        columns: [
            { display: '联系人姓名', name: 'rlNm', minWidth: 100},
            { display: '联系人类型', name: 'rlTypCdNm', minWidth: 140},
            { display: '证件类型', name: 'certTypCdNm', minWidth: 140},
            { display: '证件号', name: 'certNo', minWidth: 50, render: function(rowdata, rowindex, value){
                if (value != null && value != '') {
                    return '<a href="javascript:toCertNoCheckPage(\''+value+'\');" class="sq-button-hasicon link">'
                        + '<i class="sqBtnIco_1"></i></a>'
                        + value;
                }
            }},
            { display: '联系电话', name: 'tel', minWidth: 150},
            { display: '备注', name: 'rlRem', minWidth: 150},
        ],
        pageSize:10,
        root:'rows',
        record:'total',
        hideLoadButton : true,
        width: '100%',
        isScroll: false,
        //checkbox:true,
        rownumbers:true,
        onAfterShowData: function() {
            SetIframe_height ();
        }
    });
    npSocialRlGrid = liger.get("ligergrid_A1");
};


</script>



</body>
</html>
